<template>
	<view class="detail">
		<view class="title">
			{{detail.title}}
		</view>
		<view class="addTime">
			{{detail.add_time | dateFormat}}
		</view>
		<view class="content" v-html="detail.content">
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				detail:''
			}
		},
		methods: {
			async getNewsDetail(){
				const res = await this.$http({url:"/api/getnew/"+this.id})
				this.detail = res.data.message[0]
			}
		},
		filters:{
			dateFormat(str){
				return str.slice(0,10)
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getNewsDetail()
		}
	}
</script>

<style lang="scss">
.detail{
	.title{
		text-align: center;
		font-size: 40rpx;
		margin-top: 40rpx;
	}
	.addTime{
		font-size: 30rpx;
		padding-left: 500rpx;
		margin: 40rpx;
	}
	.content{
		padding: 20rpx;
	}
}
</style>
